package memorphic.samplr.views
{
	import flash.events.Event;
	
	import memorphic.samplr.ISamplrAppProps;
	import memorphic.slide.IStateView;
	import memorphic.slide.SlidePresModelBase;
	
	import mx.collections.ArrayCollection;
	import mx.events.ListEvent;
	
	public class BrowseViewPresModel extends SlidePresModelBase
	{
		[Bindable]
		public var appProps:ISamplrAppProps;
		
		private var __results:ArrayCollection;
		
		public function BrowseViewPresModel(view:IStateView)
		{
			super(view);
			appProps = view as ISamplrAppProps;
		}
		
		[Trigger(path="appProps.searchResults.results")]
		[Bindable(event="resultsChanged")]
		public function get searchResults():ArrayCollection
		{
			return __results;
		}
		
		public function set results(v:ArrayCollection):void
		{
			__results = v;
			dispatchEvent(new Event("resultsChanged"));
		}
		
		public function itemSelect(event:ListEvent):void
		{
			trace(event.itemRenderer.data);
		}
	}
}